package org.springboot.base.config;

import org.apache.catalina.filters.RemoteIpFilter;
import org.springboot.base.filter.MyFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ZJL
 * @DateTime 2019年2月8日 上午1:17:35
 * 自定义配置信息
 **/
@Configuration
public class WebConfiguration {
	
	@Bean
	public RemoteIpFilter remoteIpFilter() {
		return new RemoteIpFilter();
	}
	
	@Bean
	public FilterRegistrationBean testFilterRegistration() {
		FilterRegistrationBean registration = new FilterRegistrationBean();
		registration.setFilter(new MyFilter());
		registration.addUrlPatterns("/*");
		registration.addInitParameter("paramName","paramValue");
		registration.setName("myFilter");
		registration.setOrder(1);
		return registration;
	}
}
